from django_filters.rest_framework import FilterSet
from django_filters.filters import *
from .models import *


class TestReportFilterSet(FilterSet):
    name = CharFilter(lookup_expr="contains")
    start_time = DateFilter(
        field_name="create_time", lookup_expr="gte", label="开始日期"
    )
    end_time = DateFilter(field_name="create_time", lookup_expr="lt", label="结束日期")

    class Meta:
        model = TestReport
        fields = [
            "name",
            "product",
            "testplan",
            "owner",
            "creator",
            "status",
            "start_time",
            "end_time",
        ]
